<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('firstup_ad', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('激活匹配到广告数据');

            $table->increments('id');
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->integer('firstup_id')->comment('激活id')->unsigned()->default(0);
            $table->integer('match_time')->comment('匹配时间')->unsigned()->default(0);
            $table->integer('match_num')->comment('匹配次数')->unsigned()->default(0);
            $table->tinyInteger('match_type')->comment('匹配类型')->unsigned()->default(0);
            $table->integer('plan_id')->comment('计划id')->unsigned()->default(0);
            $table->integer('media_id')->comment('媒体id')->unsigned()->default(0);
            $table->integer('media_docking_id')->comment('媒体对接组id')->unsigned()->default(0);
            $table->integer('monitor_id')->comment('匹配到监控id')->unsigned()->default(0);
            $table->integer('material_id')->comment('我们后台的素材id')->unsigned()->default(0);
            $table->string('material_md5', 32)->comment('素材md5')->default('');
            $table->bigInteger('advertiser_id')->comment('媒体广告主id')->unsigned()->default(0);
            $table->integer('media_user_id')->comment('媒体账号id')->unsigned()->default(0);
            $table->bigInteger('campaign_id')->comment('推广计划id')->unsigned()->default(0);
            $table->bigInteger('adgroup_id')->comment('广告组id')->unsigned()->default(0);
            $table->bigInteger('ad_id')->comment('广告id')->unsigned()->default(0);
            $table->bigInteger('creative_id')->comment('创意id')->unsigned()->default(0);
            $table->string('campaign_name', 32)->comment('推广计划名称')->default('');
            $table->string('adgroup_name', 32)->comment('广告组名称')->default('');
            $table->string('ad_name', 32)->comment('广告名称')->default('');
            $table->string('creative_name', 32)->comment('创意名称')->default('');
            $table->string('site_set_name', 32)->comment('广告版位')->default('');
            $table->integer('ad_platform_type')->comment('广告投放平台')->unsigned()->default(0);
            $table->integer('ad_type')->comment('广告类型')->unsigned()->default(0);
            $table->integer('billing_event')->comment('计费类型')->unsigned()->default(0);
            $table->bigInteger('project_id')->comment('头条项目ID')->unsigned()->default(0);
            $table->bigInteger('promotion_id')->comment('头条广告ID')->unsigned()->default(0);
            $table->string('request_id', 32)->comment('头条请求下发id')->default('');
            $table->string('mid3', 32)->comment('头条视频素材ID')->default('');
            $table->string('project_name', 256)->comment('头条项目名称')->default('');
            $table->string('promotion_name', 256)->comment('头条广告名称')->default('');

            $table->index('create_time');
            $table->index('firstup_id');
            $table->index('match_time');
            $table->index('match_num');
            $table->index('plan_id');
            $table->index('media_id');
            $table->index('media_docking_id');
            $table->index('monitor_id');
            $table->index('material_id');
            $table->index('advertiser_id');
            $table->index('media_user_id');
            $table->index('campaign_id');
            $table->index('adgroup_id');
            $table->index('ad_id');
            $table->index('creative_id');
            $table->index('project_id');
            $table->index('promotion_id');
            $table->index('request_id');
            $table->index('mid3');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('firstup_ad');
    }
};
